import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/page/pro_list/subs/pro_detail/model/pro_detail_model/pro_detail_model.dart';
import 'package:jinke/page/pro_list/subs/pro_detail/model/pro_enterprise_model.dart';
import 'package:jinke/page/pro_list/subs/pro_detail/model/pro_phase_model/pro_phase_model.dart';
import 'package:jinke/page/pro_list/subs/pro_detail/subs/pro_base_info/widgets/cell.dart';
import 'package:jinke/utils/util.dart';

import 'index.dart';

class ProBaseInfoPage extends StatelessWidget {
  ProBaseInfoPage({
    Key? key,
    this.mod,
    this.enterprise,
  }) : super(key: key) {
    controller.state.mod = mod;
    controller.state.enterprise = enterprise;
    controller.initData();
  }
  final ProDetailModel? mod;
  final ProEnterpriseModel? enterprise;
  final controller = Get.put(ProBaseInfoController());
  // 主视图
  Widget _buildView() {
    var state = controller.state;
    return ListView(
      children: [
        ProBaseInfoCell(title: '项目信息', items: state.pros),
        ProBaseInfoCell(title: '企业信息', items: state.enterprises),
        ProBaseInfoCell(title: '要素保障', items: state.infos),
        SizedBox(
          height: 80.r,
        ),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ProBaseInfoController>(
      id: "pro_base_info",
      builder: (_) {
        return Scaffold(
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
